package com.gzy.cs5.model;

import com.gzy.cs5.lang.ItemType;

/**
 * 商品
 */
public class Item {
    private String itemId;
    private String name;   // 名称
    private double price;  // 价格
    private ItemType type; // 类型
    private int stock;     // 库存数量

    // 无参构造函数
    public Item() {
    }

    public Item(String id, String name, double price, ItemType type, int stock) {
        this.itemId = id;
        this.name = name;
        this.price = price;
        this.type = type;
        this.stock = stock;
    }

    // 新增的构造函数
    public Item(String id, String name, double price, ItemType type) {
        this.itemId = id;
        this.name = name;
        this.price = price;
        this.type = type;
    }

    // 新增的构造函数
    public Item(String id, int stock, double price) {
        this.itemId = id;
        this.stock = stock;
        this.price = price;
    }

    // 新增的构造函数
    public Item(String id, int stock, double price, ItemType type) {
        this.itemId = id;
        this.stock = stock;
        this.price = price;
        this.type = type;
    }

    // Getters and Setters
    public String getItemId() {
        return itemId;
    }

    public void setId(String id) {
        this.itemId = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public ItemType getType() {
        return type;
    }

    public void setType(ItemType type) {
        this.type = type;
    }

    public int getStock() {
        return stock;
    }

    public void setStock(int stock) {
        this.stock = stock;
    }

    @Override
    public String toString() {
        return "Item{" +
                "id='" + itemId + '\'' +
                ", name='" + name + '\'' +
                ", price=" + price +
                ", type=" + type +
                ", stock=" + stock +
                '}';
    }
}